package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.BuildertableQuery;
import com.gec.zhs.entity.po.Buildertable;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.BuildertableService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 代码生成器的表信息 Controller
 */
@RestController("buildertableController")
@RequestMapping("/buildertable")
public class BuildertableController extends ABaseController{

	@Resource
	private BuildertableService buildertableService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(BuildertableQuery query){
		return getSuccessResponseVO(buildertableService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Buildertable bean) {
		buildertableService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Buildertable> listBean) {
		buildertableService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Buildertable> listBean) {
		buildertableService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getBuildertableById")
	public ResponseVO getBuildertableById(String id) {
		return getSuccessResponseVO(buildertableService.getBuildertableById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateBuildertableById")
	public ResponseVO updateBuildertableById(Buildertable bean,String id) {
		buildertableService.updateBuildertableById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteBuildertableById")
	public ResponseVO deleteBuildertableById(String id) {
		buildertableService.deleteBuildertableById(id);
		return getSuccessResponseVO(null);
	}
}